#include <stdio.h>
#include <stdlib.h>

int main(int argc,char const *argv[])
{
    FILE *file = fopen("love.txt","a+");
    if (file == NULL)
    {
        printf("打开文件失败\n");
    }
    else
    {
        printf("打开文件成功\n");
    }


    char name[50];
    char wife[50];
    int age;
   
    while(fscanf(file, "%s %s %d", name, wife, &age) != EOF)
    {
        printf("%s在%d时爱上了%s\n", name, age, wife);
    }
    
    
    if(fclose(file) == 0)
    {
        printf("删除成功\n");
    }else
    {
        printf("删除失败\n");
    }

    return 0;

    
}